from nicegui import ui
from ex4nicegui.reactive import rxui
from ex4nicegui import on, to_ref, effect, ref_computed, batch


a = to_ref("")
b = to_ref(0)
text = ref_computed(lambda: f"a={a.value};b={b.value}")


def when_input_change(e):
    a.value = e.value


def when_slider_change(e):
    b.value = e.value


ui.input(on_change=when_input_change)
ui.slider(min=0, max=100, on_change=when_slider_change)

rxui.label(text)

ui.run()